package cn.sxt.yxl.controller.head;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import cn.sxt.yxl.common.util.ConstatFinalUtil;
import cn.sxt.yxl.users.pojo.AAdmins;
import cn.sxt.yxl.users.service.IAAdminsService;

@Controller
public class noLoginController {

	@Resource
	private IAAdminsService adminsService;

	@RequestMapping(value="/adminsList",method={RequestMethod.POST})
	public String adminsList(HttpServletRequest request) {
		ConstatFinalUtil.LOGGER.info("提交的方法"+request.getMethod());
		//获取请求头
		Enumeration enu =  request.getHeaderNames();
		while(enu.hasMoreElements()){
			String key = (String) enu.nextElement();
			ConstatFinalUtil.LOGGER.info("---请求头名称:{},键:{}",key,request.getHeader(key));
			
		}
		//获取参数
		Map<String,String[]> paramMap = request.getParameterMap();
		for (Iterator iterator = paramMap.entrySet().iterator(); iterator.hasNext();) {
			Entry en = (Entry) iterator.next();
			ConstatFinalUtil.LOGGER.info("参数名:{},值:{}",en.getKey(),en.getValue());
		}
		Map<String, Object> map = new HashMap<String, Object>();

		map.put("status", 0);
		List<AAdmins> list = adminsService.findMany(map, null);
		request.setAttribute("adminsList", list);
		return "/back/adminsList";
	}
}
